import regs from '../../util/formReg';
import util from '@/libs/util';
var LODOP = getLodop();
export default {
    components: {
    },
    data () {
        return {
            data: this.$route.params.data
        };
    },
    mounted () {
        this.initData();
    },
    methods: {
        initData () {
            LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM'));
            LODOP.PRINT_INITA(4, 10, 797, 364, '天一');
            LODOP.SET_PRINT_PAGESIZE(0, 2000, 1000, '');
            LODOP.ADD_PRINT_TEXT(22, 86, 67, 20, '单  号：');
            LODOP.ADD_PRINT_TEXT(22, 152, 100, 20, this.data.billCode);
            LODOP.ADD_PRINT_HTM(20, 281, 300, 29, '<font style=\'font-size:20px;\'>缴款凭证</font>');
            LODOP.ADD_PRINT_TEXT(71, 73, 72, 20, '缴 款 人：');
            LODOP.ADD_PRINT_TEXT(71, 156, 75, 20, this.data.studentName);
            LODOP.ADD_PRINT_TEXT(100, 73, 73, 20, '收费项目：');
            LODOP.ADD_PRINT_TEXT(100, 156, 151, 20, this.data.className);
            LODOP.ADD_PRINT_TEXT(130, 73, 74, 20, '开课/活动时间：');
            let classStartTime = this.data.classStartTime;
            if (regs.isNotEmpty(classStartTime)) {
                let d = new Date(classStartTime);
                LODOP.ADD_PRINT_TEXT(130, 157, 34, 20, d.getFullYear());
                LODOP.ADD_PRINT_TEXT(130, 205, 24, 20, d.getMonth() + 1);
                LODOP.ADD_PRINT_TEXT(130, 245, 22, 20, d.getDate());
            }
            LODOP.ADD_PRINT_TEXT(130, 186, 21, 20, '年');
            LODOP.ADD_PRINT_TEXT(130, 227, 20, 20, '月');
            LODOP.ADD_PRINT_TEXT(130, 266, 22, 20, '日');
            LODOP.ADD_PRINT_TEXT(160, 73, 73, 20, '活动/课程安排：');
            let schudule = this.data.schedule;
            if (regs.isNotEmpty(schudule)) {
                let text = '';
                for (let i in schudule) {
                    let startTime = schudule[i].classStartTime;
                    let endTime = schudule[i].classEndTime;
                    if (startTime) {
                        startTime = startTime.substring(0, 2) + ':' + startTime.substring(2, 4);
                    }
                    if (endTime) {
                        endTime = endTime.substring(0, 2) + ':' + endTime.substring(2, 4);
                    }
                    text += ' ' + util.convertNumToWeekOfDay(schudule[i].classType) + ' ' + startTime + '-' + endTime + ' ' + schudule[i].classRoomName;
                }
                LODOP.ADD_PRINT_TEXT(160, 153, 169, 55, text);
            }
            LODOP.ADD_PRINT_TEXT(71, 402, 69, 20, '联系电话：');
            LODOP.ADD_PRINT_TEXT(71, 483, 125, 20, this.data.parentPhone);
            LODOP.ADD_PRINT_TEXT(100, 402, 68, 20, '金  额：');
            LODOP.ADD_PRINT_TEXT(100, 484, 74, 20, this.data.realAmt);
            LODOP.ADD_PRINT_TEXT(100, 559, 27, 20, '元');
            // LODOP.ADD_PRINT_TEXT(160, 402, 75, 20, '教  室：');
            // LODOP.ADD_PRINT_HTM(157, 156, 169, 55, '1');
            LODOP.ADD_PRINT_TEXT(235, 73, 76, 20, '收 款 人：');
            LODOP.ADD_PRINT_TEXT(235, 159, 168, 20, this.data.chargeUser);
            LODOP.ADD_PRINT_TEXT(233, 403, 79, 20, ' 缴款日期：');
            let chargeTime = this.data.chargeTime;
            if (regs.isNotEmpty(chargeTime)) {
                let d = new Date(chargeTime);
                LODOP.ADD_PRINT_TEXT(233, 500, 34, 20, d.getFullYear());
                LODOP.ADD_PRINT_TEXT(233, 548, 24, 20, d.getMonth() + 1);
                LODOP.ADD_PRINT_TEXT(233, 588, 22, 20, d.getDate());
            }
            LODOP.ADD_PRINT_TEXT(233, 529, 21, 20, '年');
            LODOP.ADD_PRINT_TEXT(233, 570, 20, 20, '月');
            LODOP.ADD_PRINT_TEXT(233, 609, 22, 20, '日');
            LODOP.ADD_PRINT_TEXT(270, 73, 55, 20, '地址：');
            let areaId = this.data.areaId;
            let address = '';
            if (areaId == 832) { // 蓬街
                address = '蓬街文艺中心：0576-82769133 路桥区蓬街镇新蓬南路16号';
            } else if (areaId == 814) { // 三甲
                address = '三甲文艺中心：13736618886 椒江区三甲街道红绿灯往北100米';
            } else if (areaId == 813) { // 洪家
                address = '洪家汇丰路西门天一教育洪家校区 咨询电话：18767669988';
            }
            LODOP.ADD_PRINT_TEXT(270, 125, 370, 20, address);
            // LODOP.ADD_PRINT_TEXT(270, 73, 432, 20, '地址：洪家汇丰路西门天一教育洪家校区 咨询电话：18767669988');
        },
        PREVIEW () {
            this.initData();
            LODOP.PREVIEW();
        },
        PRINT_DESIGN () {
            this.initData();
            LODOP.PRINT_DESIGN();
        }
    }
};
